<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 松红
  Date: 2017/6/2
  Time: 10:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <style>
        a {
            text-decoration: none;
            color: blue;
        }

        a:hover {
            color: chocolate;
        }

        table tr td {
            border: 1px solid black;
            text-align: center;
            margin: 0;
            padding: 0;
        }

        table {
            border: 1px solid black;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<a href="/user/list">用户个人中心</a>&nbsp;&nbsp; <a href="/user/login">注销</a>
<table>
    <c:choose>
        <c:when test="${user.userClassId==0}">
            <tr>
                <td colspan="9"><h1>Hello 超级管理员：${user.userName}</h1></td>
            </tr>
        </c:when>
        <c:otherwise>
            <tr>
                <td colspan="9"><h1>Hello ${user.userClassId}班管理员：${user.userName}</h1></td>
            </tr>
        </c:otherwise>
    </c:choose>

    <tr>
        <td><strong>姓名</strong></td>
        <td><strong>性别</strong></td>
        <td><strong>电话</strong></td>
        <td><strong>学号</strong></td>
        <td><strong>班级</strong></td>
        <td><strong>地址</strong></td>
        <td colspan="3"><strong>操作</strong></td>
    </tr>
    <c:forEach var="student" items="${students}">
        <tr>
            <td>${student.studentName}</td>
            <td>${student.studentSex}</td>
            <td>${student.studentPhone}</td>
            <td>${student.studentNumber}</td>
            <td>${student.studentClassid}班</td>
            <td>${student.studentAddress}</td>
                <%--操作--%>
            <td><a href="/student/${student.studentId}/delete">删除</a></td>
            <td><a href="/student/${student.studentId}">查看</a></td>
            <td><a href="/student/${student.studentId}/update">修改</a></td>
        </tr>
    </c:forEach>

    <c:choose>
        <c:when test="${user.userClassId==0}"><%--如果为系统管理员，则不能添加学生--%>
            <tr>
                <td colspan="9"><h1>系统管理员不能添加学生</h1></td>
            </tr>
        </c:when>
        <c:otherwise><%--如果为班级管理员则能添加学生--%>
            <tr>
                <td colspan="9"><a href="/student/add">添加学生</a></td>
            </tr>
        </c:otherwise>
    </c:choose>
</table>

</body>
</html>
